<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Ajax1</title>
</head>
<body>
    <input type="button" value="获取数据" onclick="getData()">
    <div id="app">
    </div>
</body>
<script>
    function getData(){
        //创建XMLHttpRequest对象
        var xmlHttpRequest = new XMLHttpRequest();
        //发送异步请求
        xmlHttpRequest.open('GET','https://mock.apifox.cn/m1/3128855-0-default/emp/list');
        xmlHttpRequest.send();
        //获取响应数据
        xmlHttpRequest.onreadystatechange=function(){
            if (xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200) {
                document.getElementById('app').innerHTML=xmlHttpRequest.responseText;
            }
        }
    }
</script>

</html>